import type { ProjectConfig } from '/#/config';
import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '/@/enums/menuEnum';
import { CacheTypeEnum } from '/@/enums/cacheEnum';
import {
  ContentEnum,
  PermissionModeEnum,
  ThemeEnum,
  RouterTransitionEnum,
  SettingButtonPositionEnum,
  SessionTimeoutProcessingEnum,
} from '/@/enums/appEnum';
import { SIDE_BAR_BG_COLOR_LIST, HEADER_PRESET_BG_COLOR_LIST } from './designSetting';
import { primaryColor } from '../../build/config/themeConfig';

// 注意：修改配置后需要清除浏览器的缓存
const setting: ProjectConfig = {
  // 是否显示设置主题的按钮
  showSettingButton: true,

  // 是否显示切换暗黑主题的开关
  showDarkModeToggle: true,

  // 主题设置按钮的位置
  settingButtonPosition: SettingButtonPositionEnum.AUTO,

  // 路由管理模式，目前仅支持后端管理模式
  permissionMode: PermissionModeEnum.BACK,

  // 路由缓存位置
  permissionCacheType: CacheTypeEnum.LOCAL,

  // Session过期设置
  sessionTimeoutProcessing: SessionTimeoutProcessingEnum.ROUTE_JUMP,

  // 主题色
  themeColor: primaryColor,

  // 是否启用灰色模式，用于特殊纪念日
  grayMode: false,

  // 是否启用弱视模式
  colorWeak: false,

  // 是否启用内容全屏
  fullContent: false,

  // 内容布局方式
  contentMode: ContentEnum.FULL,

  // 是否显示Logo
  showLogo: true,

  // 是否显示脚部信息
  showFooter: false,

  // 头部配置
  headerSetting: {
    // 背景颜色
    bgColor: HEADER_PRESET_BG_COLOR_LIST[0],
    // 固定头部
    fixed: true,
    // 是否显示头部
    show: true,
    // 主题
    theme: ThemeEnum.LIGHT,
    // 是否显示锁屏按钮
    useLockPage: true,
    // 是否显示全屏按钮
    showFullScreen: true,
    // 是否显示文档链接
    showDoc: true,
    // 是否显示通知按钮
    showNotice: true,
    // 是否显示菜单搜索栏
    showSearch: false,
  },

  // 菜单配置
  menuSetting: {
    // 背景颜色
    bgColor: SIDE_BAR_BG_COLOR_LIST[0],
    //  是否固定左侧菜单
    fixed: true,
    // 是否展开
    collapsed: false,
    // 是否隐藏
    siderHidden: false,
    // 折叠时是否显示菜单名称
    collapsedShowTitle: false,
    // 是否可以拖拽
    canDrag: false,
    // 是否显示
    show: true,
    // 是否隐藏
    hidden: false,
    // 菜单宽度
    menuWidth: 200,
    // 显示模式
    mode: MenuModeEnum.INLINE,
    // 菜单类型
    type: MenuTypeEnum.SIDEBAR,
    // 主题
    theme: ThemeEnum.LIGHT,
    // 是否分割菜单
    split: false,
    // 顶部菜单是否居中
    topMenuAlign: 'center',
    // 折叠菜单触发方式
    trigger: TriggerEnum.HEADER,
    // 手风琴
    accordion: true,
    // Switch page to close menu
    closeMixSidebarOnChange: false,
    // Module opening method ‘click’ |'hover'
    mixSideTrigger: MixSidebarTriggerEnum.HOVER,
    // Fixed expanded menu
    mixSideFixed: false,
  },

  // Multi-label
  multiTabsSetting: {
    cache: false,
    // Turn on
    show: true,
    // Is it possible to drag and drop sorting tabs
    canDrag: true,
    // Turn on quick actions
    showQuick: true,
    // Whether to show the refresh button
    showRedo: true,
    // Whether to show the collapse button
    showFold: true,
  },

  // Transition Setting
  transitionSetting: {
    //  Whether to open the page switching animation
    // The disabled state will also disable pageLoading
    enable: true,

    // Route basic switching animation
    basicTransition: RouterTransitionEnum.FADE_SIDE,

    // Whether to open page switching loading
    // Only open when enable=true
    openPageLoading: false,

    // Whether to open the top progress bar
    openNProgress: true,
  },

  // Whether to enable KeepAlive cache is best to close during development, otherwise the cache needs to be cleared every time
  openKeepAlive: true,

  // Automatic screen lock time, 0 does not lock the screen. Unit minute default 0
  lockTime: 0,

  // Whether to show breadcrumbs
  showBreadCrumb: true,

  // Whether to show the breadcrumb icon
  showBreadCrumbIcon: true,

  // Use error-handler-plugin
  useErrorHandle: false,

  // Whether to open back to top
  useOpenBackTop: true,

  //  Is it possible to embed iframe pages
  canEmbedIFramePage: true,

  // Whether to delete unclosed messages and notify when switching the interface
  closeMessageOnSwitch: true,

  // Whether to cancel the http request that has been sent but not responded when switching the interface.
  // If it is enabled, I want to overwrite a single interface. Can be set in a separate interface
  removeAllHttpPending: false,
};

export default setting;
